package com.learn.mvc.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;

@Controller
public class UploadHandler {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @RequestMapping("/file/upload")
    public String doUpload(
            @RequestParam("username") String username,
            @RequestParam("picture") MultipartFile picture
            ) throws IOException {

        logger.debug(username);
        int len = 0;
        byte[] buff = new byte[1024];
        InputStream is = picture.getInputStream();

        
        return "target";
    }

}
